<?php
namespace Home\Controller;

use Think\Controller;

/**
 * 产品处理控制器
 * User: xupeng
 * Date: 2016/7/6
 * Time: 15:05
 */
class ProductController extends LoginBaseController
{

    public function home()
    {
        $this->assign('page_name', "首页");
        $this->display('home/home');

    }

    /**
     * 转发至查询列表界面
     */
    public function productList()
    {
        $this->assign('page_name', "产品列表页");
        $this->display('product/productlist');
    }

    /**
     * 显示商品添加界面
     */
    public function addProductPage()
    {
        $this->assign('page_name', "商品新增页");
        $this->assign('operate_name', '新增商品');
        $this->display('product/addproduct');
    }

    /**
     * 显示商品编辑界面
     */
    public function editProductPage()
    {

        $product = M('product', '', 'DB_product')->where('product_id = "%s"', array(I('product_id')))->find();
        $this->assign('operate_name', '更新商品');
        $this->assign('product', $product);
        $this->assign('page_name', "商品修改页");

        $this->display('product/addproduct');
    }

}

?>